package com.qd.common.panda.domain.entity.carpark;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 停车时段
 *
 * @author sjk
 */
@Getter
@Setter
public class CarParkTimeDTO {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "停车时段";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "时段ID"})
    @NotBlank(message = "时段ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "时段ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    @JsonProperty("tId")
    private String tId;
    /**
     * 开始时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "开始时间"})
    @NotNull(message = "开始时间不能为空", groups = DefaultGroup.class)
    private String startTime;
    /**
     * 结束时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "结束时间"})
    @NotNull(message = "结束时间不能为空", groups = DefaultGroup.class)
    private String endTime;
    /**
     * 停车场标识
     */
    @ExcelProperty(value = {EXCEL_TITLE, "停车场标识"})
    @NotBlank(message = "停车场标识不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "停车场标识长度不能超过{max}位", groups = DefaultGroup.class)
    @JsonProperty("pId")
    private String pId;

    public void freeData() {
        this.tId = null;
        this.startTime = null;
        this.endTime = null;
        this.pId = null;
    }
}
